package com.whc.gulimall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.whc.common.to.mq.SecKillTO;
import com.whc.common.utils.PageUtils;
import com.whc.gulimall.order.entity.OrderEntity;
import com.whc.gulimall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author wanghaochen
 * @email angaoen@outlook.com
 * @date 2022-03-05 00:16:47
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 获取订单信息
     *
     * @return 订单信息
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 提交订单
     *
     * @param submitVo 订单提交信息vo
     * @return 订单结果vo
     */
    SubmitOrderResponseVo summitOrder(OrderSubmitVo submitVo) throws ExecutionException, InterruptedException;

    /**
     * 通过orderSN获取订单状态
     *
     * @param orderSN orderSN
     * @return 订单状态
     */
    Integer getOrderStatusByOrderSN(String orderSN);

    /**
     * 关闭订单
     *
     * @param entity 订单信息
     */
    void closeOrder(OrderEntity entity);

    PayVo createPayVO(String orderSn);

    PageUtils listOrderItem(Map<String, Object> params);

    /**
     * 处理支付宝支付
     *
     * @param vo 数据
     * @return 成功
     */
    String handleAliPayed(PayAsyncVo vo);

    /**
     * 创建秒杀订单
     *
     * @param to 订单信息
     */
    void createKillOrder(SecKillTO to);
}

